/**
 * 退出系统
 */
package org.hehui.supervisorysystem.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.hehui.supervisorysystem.util.IAppConstants;
import org.hehui.supervisorysystem.util.IImageKey;


/**
 * @author 贺辉
 *
 */
public class ExitAction extends Action {
	public ExitAction(){
		setId("org.hehui.supervisorysystem.actions.exitAction");
		setText("Exit@ALT+E");
		setToolTipText("Exit");
		//setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(IAppConstants.APPLICATION_ID, IImageKey.EXIT));
		
	}


	@Override
public void run() {
		MessageBox msgBox = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.ICON_QUESTION|SWT.YES|SWT.NO);
		msgBox.setText("Really Exit?");
		msgBox.setMessage("Really Exit?");
		int rc = msgBox.open();
		if(rc == SWT.YES){
			PlatformUI.getWorkbench().close();
		}else{
			return;
		}
	
	}
	
	
}
